//
//  BMWebController.m
//  砼车Demo
//
//  Created by apple on 16/1/5.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "BMWebController.h"

@interface BMWebController ()<UIWebViewDelegate>

@property (nonatomic,weak)UIWebView *webView;

@end

@implementation BMWebController

- (void)loadView
{
    UIWebView *webview = [UIWebView new];
    webview.delegate = self;
    self.view = webview;
    _webView = webview;
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    if(_path)
    {
        [self.webView loadRequest:[NSURLRequest requestWithURL:_path]];
    }
    else{
            [self getData];
        }
}

- (void)getData{
    
//    weakSelf(self);
//    BMRequest *request = [BMRequest requestWithPath:@"getSinglePageByType.htm"];
//    NSMutableString *typeStr = [NSMutableString stringWithString:kRoleType ? @"站点端" : @"车主端"];
//    NSString *destStr;
//    switch (_type) {
//        case 1:
//            destStr = [typeStr stringByAppendingString:@"使用指南"];
//            break;
//        case 2:
//            destStr = [typeStr stringByAppendingString:@"关于平台"];
//            break;
//        case 3:
//            destStr = [typeStr stringByAppendingString:@"注册协议"];
//            break;
//    }
//    self.title = destStr;
//    request.params = @{@"typeName" : destStr};
//    [self showHudWithhint:kDefaultMessage];
//    [[BMHttpTool sharedInstance] postWith:request finish:^(BMResponse *response, NSError *error) {
//        [self hideHud];
//        if (response.status == kResultOK) {
//            NSString *content = response.rawResult[@"singlePage"][@"content"];
//            if (![BMUtils isEmptyString:content]) {
//                [weakSelf.webView loadHTMLString:content baseURL:nil];
//            }
//            self.title = response.rawResult[@"singlePage"][@"typeName"];
//        } else {
//            [self showHint:response.msg];
//        }
//    }];
    
}

- (void)webViewDidFinishLoad:(UIWebView *)webView{
    
//    if ([BMUtils isEmptyString:self.title]) {
//        NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
//        self.title = title;
//    }
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
